package com.stylefeng.guns.modular.pay.exception;

import org.apache.logging.log4j.util.Strings;

import com.stylefeng.guns.core.util.MD5Utils;
import com.stylefeng.guns.core.util.ObjectUtils;

public class ResultUtil {

	public static Result error(String code, String msg, String key) {
		Result result = new Result();
		result.setRespCode(code);
		result.setRespMsg(msg);
		if (Strings.isNotBlank(key)) {// 签名
			try {
				result.setSign(MD5Utils.getSign(ObjectUtils.Obj2Map(result), key));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return result;
	}
}
